#pragma once

#include <QWidget>
#include <QHBoxLayout>
#include "ui_ktloginwidget.h"
#include "ktloginstruct.h"

QT_BEGIN_NAMESPACE
namespace Ui { class KtLoginWidgetClass; };
QT_END_NAMESPACE

class KtLoginAccountWgt;
class KtLoginSettingWgt;
class KtCarouselImageWgt;
class KtLoginWgt : public QWidget
{
	Q_OBJECT

public:
	KtLoginWgt(QWidget *parent = nullptr);
	~KtLoginWgt();
	// Carousel image
	void setCarouselImageVisible(bool bShow);
	bool getCarouselImageVisible();
	void setCarouselImage(const QPixmap& pixmap, bool bShow = true);
	
	// Login widget
	void setTitlePic(const QIcon& icon);
	void setTitleText(const QString& text);
	void setLoginInfo(const KtLoginInfo& info);
	KtLoginInfo getLoginInfo();

	// Account
	void setLoginTitleText(const QString& text);
	void setRemembCBoxVisible(bool bShow);
	bool remembCBoxVisible();
	void setAutoLoginCBoxVisible(bool bShow);
	bool autoLoginCBoxVisible();
	void setAccountInfo(KtLoginAccountInfo info);

	// Setting
	void setSettingInfo(KtLoginSettingInfo info);

Q_SIGNALS:
	void settingBtnClickedSgl();
	void loginBtnClickedSgl(const KtLoginInfo& info);
	void settingInfoChanagedSgl(const KtLoginSettingInfo& info);

private Q_SLOTS:
	void settingBtnClickedSlt();
	void loginBtnClickedSlt();
	void settingSureSlt(KtLoginSettingInfo info);
	void settingCancelSlt();

private:
	void initStyle();
	void initConnect();

protected:
	virtual void resizeEvent(QResizeEvent* event)Q_DECL_OVERRIDE;
	void paintEvent(QPaintEvent* event);
	void setSettingWgtVisible(bool visible);

private:
	Ui::KtLoginWidgetClass *ui;
	KtLoginAccountWgt* m_accountWgt;
	KtLoginSettingWgt* m_settingWgt;
	KtCarouselImageWgt* m_picWgt;
	QWidget* m_loginWgt;
	QHBoxLayout* m_hBoxLayout;
	bool m_bShowCarouselImage;
};
